package com.zz.nondatain.repository;

import com.zz.nondatain.model.ExampleModel;
import com.zz.nondatain.model.UserModel;

import io.reactivex.rxjava3.core.Observable;

/**
 * 示例仓库类，处理数据获取逻辑
 */
public class ExampleRepository extends BaseRepository {
    
    private static ExampleRepository instance;
    
    private ExampleRepository() {
        super();
    }
    
    /**
     * 获取ExampleRepository单例
     */
    public static synchronized ExampleRepository getInstance() {
        if (instance == null) {
            instance = new ExampleRepository();
        }
        return instance;
    }
    
    /**
     * 获取示例数据
     */
    public Observable<ExampleModel> getExampleData(int id) {
        return handleResponse(apiService.getExampleData(id))
                .compose(applySchedulers());
    }
    
    /**
     * 用户登录
     */
    public Observable<UserModel> login(String username, String password) {
        return handleResponse(apiService.login(username, password))
                .compose(applySchedulers());
    }
} 